package com.wyy.stujpa.controller;

import com.wyy.stujpa.entity.JavaClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;

@Controller
public class TClassController {

    //创建logger对象，在需要记录日志的地方，调用logger对象的方法，记录日志
    Logger logger = LoggerFactory.getLogger(TClassController.class);

    @RequestMapping("/list")
    public String query(ModelMap map){
        /*logger.debug();
        logger.info();
        logger.warn();
        logger.error();*/
        logger.warn("执行了list请求");
        map.put("word","tom,下午好，欢迎您使用");
        JavaClass jc = new JavaClass();
        jc.setcName("java2002");
        jc.setcIntro("企业级开发");

        JavaClass jc1 = new JavaClass();
        jc1.setcName("h52002");
        jc1.setcIntro("web开发");

        JavaClass jc2 = new JavaClass();
        jc2.setcName("嵌入式2002");
        jc2.setcIntro("软硬件集合开发");

        ArrayList<JavaClass> list = new ArrayList<>();
        list.add(jc);
        list.add(jc1);
        list.add(jc2);
        map.put("javaClass",list);
        logger.warn("执行list请求结束了...");
        return "first";//找html页面
    }
}
